﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class eagle : MonoBehaviour
{
    // Start is called before the first frame update
    Vector3 movement;
    GameObject left;
    float speed=6;
    float countTime=2;
    float time;
    void Start()
    {
        left=GameObject.Find("left");
    }

    // Update is called once per frame
    void Update()
    {
        time+=Time.deltaTime;
        if(time>=countTime)speed=0;
        if(time>=countTime+0.5)speed=22;
        MoveGround();
    }
    void MoveGround(){
        movement.x=speed;
        transform.position-=movement*Time.deltaTime;
        if(transform.position.x<=left.transform.position.x)Destroy(gameObject);
    }
    
}
